package com.example.kpopnews.main.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.example.kpopnews.KpopNewsActivity;
import com.example.kpopnews.R;
import com.example.kpopnews.event.ui.ListEventsActivity;
import com.example.kpopnews.news.ui.ListNewsActivity;
import com.example.kpopnews.video.ui.ListYoutubeVideosActivity;
import com.example.kpopnews.wallpaper.ui.ListWallpapersActivity;

//******************************************************************
public class MainActivity extends KpopNewsActivity
// ******************************************************************
{

    // ******************************************************************
    @Override
    protected void onCreate(Bundle savedInstanceState)
    // ******************************************************************
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        startActivity(R.id.button_events, ListEventsActivity.class);
        startActivity(R.id.button_news, ListNewsActivity.class);
        startActivity(R.id.button_videos, ListYoutubeVideosActivity.class);
        startActivity(R.id.button_wallpapers, ListWallpapersActivity.class);
    }

    // ******************************************************************
    private void startActivity(int buttonId, final Class<?> activityTarget)
    // ******************************************************************
    {
        Button buttonLogin = (Button) findViewById(buttonId);
        buttonLogin.setOnClickListener(new OnClickListener()
        {
            // ******************************************************************
            @Override
            public void onClick(View v)
            // ******************************************************************
            {
                Intent intent = new Intent(MainActivity.this, activityTarget);
                startActivity(intent);
            }
        });
    }

}
